package 第九章作业.O602;

public class HumanTest {
    public static void main(String[] args) {
        System.out.println("-----正常方法调用-----");

        NorthPeople p1 = new NorthPeople();
        p1.eat();
        p1.StewedVegetables();
        p1.SteamedBuns();
        System.out.println();

        SouthPeople p2 = new SouthPeople();
        p2.eat();
        p2.FriedVegetables();
        p2.Rice();

        System.out.println("-----多态方法调用-----");

        //向上转型
        Human p3 = new NorthPeople();
        p3.eat();
        Human p4 = new SouthPeople();
        p4.eat();
        System.out.println();
        //向下转型
        NorthPeople N = (NorthPeople) p3;
        N.eat();
        N.StewedVegetables();
        N.SteamedBuns();
        System.out.println();

        SouthPeople S = (SouthPeople) p4;
        S.eat();
        S.FriedVegetables();
        S.Rice();
    }
}
